home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4163 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: void main() and other atrocities!
  5. Date: Fri, 02 Feb 1996 12:18:17 GMT
  6. Organization: Netcom
  7. Message-ID: <3111ffd5.37926464@nntp.ix.netcom.com>
  8. References: <4eduaj$1aq@grouper.Exis.Net> <4em17r$shq@jaxnet.jaxnet.com> <4emub9$1mo@fountain.mindlink.net> <4epplj$egf@host-3.cyberhighway.net> <4erjn2INN38b@keats.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: ix-dc8-16.ix.netcom.com
  10. X-NETCOM-Date: Fri Feb 02  4:18:50 AM PST 1996
  11. X-Newsreader: Forte Agent .99c/16.141
  12.  
  13. c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) wrote:
  14.  
  15. > In article <4epplj$egf@host-3.cyberhighway.net>,
  16. >  <mjellis@cyberhighway.net> wrote:
  17. >  >Hey...ease up buddy.  I'm one of those idiots that made such a post 'void main()' and a nice gentlemen sent me an email informing me of the ANSI standard regarding this.
  18. >  >
  19. >  >Because of this nice gentlemen's information, now I know better.  And, he didn't scare me off this newsgroup be blowing my head off with a cannon!  Email works wonders and it's *so* much more courteous.
  20. > There is nothing with 'void main()'. It's not giverned by the ANSI standard,
  21. > first of all, because that is not an ANSI definition. An ANSI definiton would
  22. > be more like 'void main(void)'.
  23. > You don't need main() to be defined has having any sort of return value unless
  24. > you plan to "return" out of it. If you use exit(0) like me, declaring the
  25. > function void is ok, since your function never returns.
  26. > The antsy standard is _great_ for assuring me that my bike helmet is safe, mind
  27. > you.
  28.  
  29. Please be careful when posting jokes -- some people might take them
  30. seriously.  There actually are people who have so little knowledge of
  31. the C language that they think void main(void) is a legal C.  Of
  32. course, as anyone who has actually read the standard is aware (or, at
  33. least, anyone except Shildt), defining main as returning void results
  34. in undefined behavior.  The standard allows the program to do anything
  35. (format you disk, send nasty email to our boss, start world war III,
  36. ..).
  37.  
  38. By the way, "void main()" is just as much an ANSI definition (or,
  39. rather, the start of one) as "void main(void)".
  40.  
  41.  
  42. Michael M Rubenstein
  43.